export function flatRoute(routes, judge) {
  const array = []
  !!(routes instanceof Array) && routes.forEach(route => {
    if (judge) {
      console.log(judge(route))
      if (judge(route)) {
        array.push(route)
      }
    } else {
      array.push(route)
    }
    if (route.children) {
      array.push(...flatRoute(route.children, judge))
    }
  })
  return array
}
